var code;
function changeImg(){
    var arrays = new Array(
        '1','2','3','4','5','6','7','8','9','0',
        'a','b','c','d','e','f','g','h','i','j',
        'k','l','m','n','o','p','q','r','s','t',
        'u','v','w','x','y','z',
        'A','B','C','D','E','F','G','H','I','J',
        'K','L','M','N','O','P','Q','R','S','T',
        'U','V','W','X','Y','Z'
    );
    code = "";
    for(var i = 0; i < 4; i++){
        var r = parseInt(Math.random() * arrays.length);
        code += arrays[r];
    }
    document.getElementById('code').innerHTML = code;
}

function check(){
    var input_name = document.getElementById('ipt_name').value;
    var input_passwd = document.getElementById('ipt_pass').value;
    var input_code = document.getElementById('vcode').value;

    if (input_name == ""){
        alert("请输入用户名!");
        return false;
    }

    if (input_passwd == ""){
        alert("请输入密码!");
        return false;
    }

    if (input_code == ""){
        alert("请输入验证码!");
        return false;
    }

    if(input_code.toLowerCase() != code.toLowerCase()) {
        alert("请输入正确的验证码!");
        return false;
    }

}

function check2(){
    var pawd_input_name = document.getElementById('pawd_ipt_name').value;
    var pawd_input_passwd = document.getElementById('pawd_ipt_pass').value;
    var pawd_input_passwd2 = document.getElementById('pawd_ipt_pass2').value;
    var pawd_input_code = document.getElementById('pawd_vcode').value;

    if (pawd_input_name == ""){
        alert("请输入用户名!");
        return false;
    }

    if (pawd_input_passwd == ""){
        alert("请输入密码!");
        return false;
    }

    if (pawd_input_passwd2 == ""){
        alert("请输入确认密码!");
        return false;
    }

    if (pawd_input_passwd != pawd_input_passwd2){
        alert("两次输入的密码不一致，请重新输入!");
        return false;
    }

    if (pawd_input_code == ""){
        alert("请输入验证码!");
        return false;
    }

    if(pawd_input_code.toLowerCase() != code.toLowerCase()) {
        alert("请输入正确的验证码!");
        return false;
    }

}
